<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Quản lý bài viết</title>
        <link rel="stylesheet" href="../../../public/css/screen.css" type="text/css" media="screen" title="default" />
        <link rel="stylesheet" href="../../../public/js/jquery/jquery-ui.css"/>
        <link rel="stylesheet" href="../../../public/css/lightbox.css"/>
        <link rel="stylesheet" href="../../../public/css/edit.css"/>

        <!--  jquery core -->
        <script src="../../../public/js/jquery/jquery-1.8.2.js" type="text/javascript"></script>
        <script src="../../../public/js/jquery/jquery-ui.js" type="text/javascript"></script>
        <!--  checkbox styling script -->
        <script src="../../../public/js/jquery/ui.core.js" type="text/javascript"></script>
        <script src="../../../public/js/jquery/jquery.bind.js" type="text/javascript"></script>
        <!--  styled select box script version 1 -->


        <!-- Java script jquery for tinymce editor -->
        <script src="../../../public/js/tiny_mce/tiny_mce.js" type="text/javascript"></script>
        <script type="text/javascript">
            tinyMCE.init({
                mode : "exact",
                language : "en",
                elements : "textnew",
                theme : "advanced",
                plugins : "azupload,advimage,wpEditImage,paste,preview",
                theme_advanced_buttons1_add : "azupload,pastetext,preview",
                theme_advanced_buttons2_add : "image,wp_editbtns"
            });
        </script>
         <!--Script validate from data -->
        <script type="text/javascript" src="../../../public/js/jquery/jquery.validate.js"></script>
        <script type="text/javascript" src="../../../public/js/jquery/jquery.validate.pack.js"></script>
        <!-- End validate from data -->
        <script src="../../../public/js/jquery/jquery.pngFix.pack.js" type="text/javascript"></script>
        <script src="../../../public/js/jquery/ui.checkbox.js" type="text/javascript"></script>
        <script src="../../../public/js/jquery/jquery.bind.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function(){
                $(document).pngFix( ); 
                $('input').checkBox();
                $('#toggle-all').click(function(){
                    $('#toggle-all').toggleClass('toggle-checked');
                    $('#mainform input[type=checkbox]').checkBox('toggle');
                    return false;
                });
                //Jquery accordion block
                $('#block_when_add_new').accordion({
                    heightStyle: "content"
                });
                
                //Onchange event 
                $('#new_link_img').change(function(){
                    var src = $('#new_link_img').val();
                    if(src != null && src != ''){
                        var img = '<img src="'+src+'" width="130px" height="130px" alt="Featured Image" />';
                        $('#frm_img_featured').html(img);
                    }else{
                        $('#frm_img_featured').html('');
                    }
                });
                
                //Validate from add news
                $.fn.validateFrmAddNew = function(){
                    $('#frm_addnew').validate({
                        rules:{
                            title:{
                                required:true,
                                minlength:3
                            },
                            newdes:{
                                required: true,
                                minlength:3
                            },
                            newtags:{
                                required: true
                            },
                            textnew:{
                                required: true
                            }
                        },
                        messages:{
                            title:{
                                required:"Vui lòng nhập tiêu đề cho bài viết",
                                minlength:"Độ dài tối thiểu phải là 2 ký tự"
                            },
                            newdes:{
                                required:"Vui lòng nhập mô tả cho bài viết",
                                minlength:"Độ dài tối thiểu phải là 2 ký tự"
                            },
                            newtags:{
                                required: "Vui lòng nhập tags cho bài viết",
                                minlength:"Độ dài tối thiểu phải là 2 ký tự"
                            },
                            textnew:{
                                required: "Vui lòng nhập tags cho bài viết"
                            }
                        }
                    });
                };
                
                //Call ajax submit add new
                $('#frm_add_news_btn_submit').click(function(){
                    //Call function validate from
                    $(this).validateFrmAddNew();
                    //Get result when from validate
                    var result =  $("#frm_addnew").valid();
                    if(result){
                        alert('Okie');
                    }else{
                        alert(tinyMCE.activeEditor.getContent());
                    }
                });
            });
        </script>
        <![if !IE 7]>
        <!--  styled select box script version 1 -->
        <script src="../../../public/js/jquery/jquery.selectbox-0.5.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function() {
                $('.styledselect').selectbox({ inputClass: "selectbox_styled" });
            });
        </script>
        <![endif]>
        <!--  styled select box script version 2 --> 
        <script src="../../../public/js/jquery/jquery.selectbox-0.5_style_2.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function() {
                $('.styledselect_form_1').selectbox({ inputClass: "styledselect_form_1" });
                $('.styledselect_form_2').selectbox({ inputClass: "styledselect_form_2" });
            });
        </script>
        <!--  styled select box script version 3 --> 
        <script src="../../../public/js/jquery/jquery.selectbox-0.5_style_2.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function() {
                $('.styledselect_pages').selectbox({ inputClass: "styledselect_pages" });
            });
        </script>
        <!-- Custom jquery scripts -->
    </head>
    <body> 
        {banner}
        <div class="clear">&nbsp;</div>
        {menu}
        <div class="clear"></div>
        {view_post}
        <div class="clear">&nbsp;</div>
        {footer}

    </body>
</html>